iPhoneJS.extend({
	attr: function( elem, name, value ) {
		var set = value !== undefined;
		if ( set )
			elem.setAttribute( name, value );
		else
			var attr = elem.getAttribute( name );
			// Non-existent attributes return null, we normalize to undefined
			return attr === null ? undefined : attr;
	},
	css:function(elem, name, value){
		var set = value !== undefined;
		if( !set ){
			var prop = document.defaultView.getComputedStyle(elem,null).getPropertyValue(name);
			return prop === null ? undefined : prop;
		}
		else{
			for (var property in value){
				elem.style[property] = value[property];
			}
		}
	}
});
iPhoneJS.fn.extend({
	attr: function( name, value ) {
		if ( typeof name === "string" ) {
			// Are we setting the attribute?
			if ( value === undefined ) {
				return this.length ? iPhoneJS.attr( this[0], name ) : null;
			} else {
				iPhoneJS.attr( this[0], name, value );
			}
		}

		return this;
	},
	css:function( value ){
		if ( typeof value === "string" ) {
			return this.length ? iPhoneJS.css( this[0], value ) : null;
		} else {
			iPhoneJS.css( this[0], null, value );
		}

		return this;
	}
});